
QUITE :=@
#CROSS_COMPILE    ?= arm-linux-gnueabi-
# Tools
CC           = $(CROSS_COMPILE)gcc
CXX          = $(CROSS_COMPILE)g++
AS           = $(CROSS_COMPILE)as
AR           = $(CROSS_COMPILE)ar
LD           = $(CROSS_COMPILE)ld
RM           = rm -rf
MKDIR        = mkdir
OBJDUMP      = $(CROSS_COMPILE)objdump
OBJCOPY	     = $(CROSS_COMPILE)objcopy
STRIP        = $(CROSS_COMPILE)strip


CSRCS= $(wildcard *.c)
CPPSRCS= $(wildcard *.cpp)
VPATH += .
INCLUDE    =	-I. -I../
BINS= 	$(patsubst %.c, %, $(CSRCS))
CPPBINS= $(patsubst %.cpp, %, $(CPPSRCS))
DEFINE += -D_GNU_SOURCE
# -Werror
CFLAGS +=   -std=c99   -O2  $(DEFINE) $(INCLUDE) $(GLB_INCLUDE)
CPPFLAGS +=  -Werror  -std=c++11   -O2  $(DEFINE) $(INCLUDE) $(GLB_INCLUDE)

LIB_DEP = rt m pthread c
LIBS = $(addprefix -l, $(LIB_DEP))

all:$(BINS) $(CPPBINS)
	@echo "done!"
	

.PHONY: all  clean  
$(BINS):%:%.c
	$(CC)  $(CFLAGS) $(INCLUDE)   -o $@  $< $(LIBS)
$(CPPBINS):%:%.cpp
	$(CXX)  $(CPPFLAGS) $(INCLUDE)   -o $@  $< $(LIBS)
clean:
	$(RM) $(BINS) $(CPPBINS)